In addition, follow these guidelines to optimize frame rate performance:
A program is free to do non-graphics computation during the wait cycle between vertical retraces. Therefore, issue a glXSwapBuffers() call immediately after sending the last graphics call for the current frame, perform computation needed for the next frame, then execute OpenGL calls for the next frame, call glXSwapBuffers(), and so on.
Clearing a full screen takes time. If you make additional drawing calls immediately after a screen clear, you may fill up the graphics pipeline and force the program to stall. Instead, do some non-drawing work after the clear.